package com.kurumi.service;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import com.kurumi.pojo.MedicalRecord;
import com.kurumi.pojo.upload.UploadScan;
import com.kurumi.query.MedicalRecordQuery;
import com.kurumi.query.MedicalRecordScanQuery;
import com.kurumi.query.UploadScanQuery;

public interface MedicalRecordScanService {

	/**
	 * 获取扫描病案
	 * @return
	 */
	List<Map<String,Object>> getMedicalRecordOfScan(MedicalRecordScanQuery query);
	
	/**
	 * 获取扫描病案数量
	 * @return
	 */
	int getMedicalRecordCountOfScan(MedicalRecordScanQuery query);
	
	void scanImagesUpload(String visitGuid,MultipartFile[] uploadImages)throws IllegalStateException, IOException;

	List<Map<String,Object>> getImageFilesByVisitGuid(String visitGuid);
	
	List<Map<String,Object>> getImageFilesByVisitGuidAndPrinterTypeCode(String visitGuid,String printerTypeCode);
	
	List<Map<String,Object>> getImageFileByFileHash(String fileHash);
	
	int imagePagination(String visitGuid,String fileHash,String newPageTypeCode);
	
	
	List<Map<String,Object>> getPaginationCountByVisitGuid(String visitGuid);
	
	int getUnPaginationImageCountByVisitGuid(String visitGuid);
	
	int imagePaginationFinish(String visitGuid);
	
	
	/**
	 * 获取扫描纸质交接病案
	 * @return
	 */
	List<Map<String,Object>> getMedicalRecordOfScanSend(MedicalRecordQuery medicalRecordQuery);
	
	/**
	 * 获取扫描纸质交接病案数量
	 * @return
	 */
	int getMedicalRecordCountOfScanSend(MedicalRecordQuery medicalRecordQuery);
	
	
	int thirdScanUpload(Map<String, UploadScan> uploadScanMap);
	
	
	/**
	 * 获取第三方文件上传
	 * @return
	 */
	List<Map<String,Object>> getUploadScanByQuery(UploadScanQuery query);
	
	/**
	 * 获取第三方文件上传数量
	 * @return
	 */
	int getUploadScanCountByQuery(UploadScanQuery query);
	
	/**
	 * 病案关联
	 * @param medicalRecord
	 * @param uploadScanId
	 * @return
	 */
	int addMedicalRecordRelevance(MedicalRecord medicalRecord,Integer uploadScanId);
	
	int medicalRecordRelevance(String mrId,Integer visitNumber,Integer uploadScanId);
	
	List<Map<String,Object>> getMedResourceByFirstLevelGuid(@Param("firstLevelGuid") String firstLevelGuid);

	List<Map<String, Object>> getPaginationScanFilesByFirstGuidAndPagination(String firstGuid,
			String pagination);
	
	List<Map<String,Object>> getMrPageTypes();
	
	List<Map<String,Object>> getMrPageTypesOfPaginationCountByFirstGuid(@Param("firstGuid")String firstGuid);
    
	int getScanFilePaginationCount(String firstGuid,String unPagination);
	
	int paginationMedrecordImage(String firstGuid,String fileHash,Integer mrPageTypeId);
	
	List<Map<String,Object>> getMrPageTypesOfPaginationCountByFirstGuidAndMrPageTypes(String firstGuid,List<Integer> mrPageTypes);

	int removeMedRecordImage(String firstGuid,String fileHash);
	
	void updateScanFilrOriginalName(String fileHash,String preOriginalName);

	List<Map<String, Object>> getMedicalRecordScanSend(MedicalRecordQuery params);

	int getMedicalRecordCountScanSend(MedicalRecordQuery params);
}
